package com.maikec.utils.mybatis;
/**
 * 邢帅教育
 * <p>
 * 本源代码由数据中心及其作者共同所有，未经版权持有者的事先书面授权，
 * 不得使用、复制、修改、合并、发布、分发和/或销售本源代码的副本。
 *
 * @copyright Copyright (c) 2018. [图片]xsteach.com all rights reserved.
 */

import com.maikec.utils.mybatis.base.BaseServiceImpl;
import com.maikec.utils.mybatis.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author maikec
 * @date 2018/7/17
 */
@Service
public class CourseServiceImpl extends BaseServiceImpl<User> implements CourseService {
    private final JdbcTemplate jdbcTemplate;
    @Autowired
    public CourseServiceImpl(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }
    @Override
    @Transactional(readOnly = false, rollbackFor = Exception.class)
    public int insertMore(){
        User user = new User();
        for (int i = 0; i < 5; i++) {
            user.setName("user"+i);
            insert(user);
        }
       int i = 10/0;
        return 0;
    }
    public User getUser(User user) {
        return selectById(user);
    }
    public User getUser(int id) {
        User user = new User();
        user.setId(id);
        return selectById(user);
    }


}
